package cn.jobstart.controller;
import cn.jobstart.es.service.IResumeEsService;
import cn.jobstart.web.common.SkJsonResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RestController;
import cn.jobstart.pubInter.exception.SkException;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.RestfulController;
import cn.jobstart.dto.ResumeEmploymentIntentionDTO;
import cn.jobstart.dto.ResumeEmploymentIntentionPageDTO;
import cn.jobstart.modelExt.ResumeEmploymentIntentionExt;
import cn.jobstart.searchExt.ResumeEmploymentIntentionSearchExt;
import cn.jobstart.service.IResumeEmploymentIntentionService;
import cn.jobstart.vo.ResumeEmploymentIntentionDetailVO;
import cn.jobstart.vo.ResumeEmploymentIntentionListVO;
import cn.jobstart.vo.ResumeEmploymentIntentionDomainVO;
import cn.jobstart.vo.ResumeEmploymentIntentionDetailDomainVO;
import cn.jobstart.export.ResumeEmploymentIntentionDomainExport;
import cn.jobstart.controller.ApiManageController;
import org.springframework.validation.annotation.Validated;
import java.util.Set;
import java.util.HashSet;
import cn.jobstart.pubInter.exception.BusinessException;

/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description ResumeEmploymentIntentionController      求职意向
*/
@Api(tags = "人才管理系统-求职意向相关", description = "求职意向相关接口")
@RestController(value ="resumeEmploymentIntentionRestfulController")
@RequestMapping("/resumeEmploymentIntention/")
@Validated
public class ResumeEmploymentIntentionController extends ApiManageController<ResumeEmploymentIntentionDTO,ResumeEmploymentIntentionPageDTO,ResumeEmploymentIntentionExt, ResumeEmploymentIntentionSearchExt,ResumeEmploymentIntentionDomainVO,ResumeEmploymentIntentionDetailDomainVO,ResumeEmploymentIntentionDetailVO,ResumeEmploymentIntentionListVO,String> {

	@Resource(name = "resumeEmploymentIntentionService")
	private IResumeEmploymentIntentionService resumeEmploymentIntentionService;


	@Resource
	private IResumeEsService resumeEsService;


	@Override
	public void afterPostAdd(ResumeEmploymentIntentionDTO dto, ResumeEmploymentIntentionExt domain, ResumeEmploymentIntentionDetailVO resumeEmploymentIntentionDetailVO, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostAdd(dto, domain, resumeEmploymentIntentionDetailVO, request, session);
		resumeEsService.publishResumeEmploymentIntentionByResumeId(domain.getResumesId());
	}

	@Override
	public void afterPostMod(ResumeEmploymentIntentionDTO dto, ResumeEmploymentIntentionExt domain, SkJsonResult<ResumeEmploymentIntentionDetailVO> jsonResult, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostMod(dto, domain, jsonResult, request, session);
		resumeEsService.publishResumeEmploymentIntentionByResumeId(domain.getResumesId());
	}

	@Override
	public IBaseService<ResumeEmploymentIntentionExt, ResumeEmploymentIntentionSearchExt,String> getBaseService() throws SkException {
		return resumeEmploymentIntentionService;
	}

	@Override
	public String getBaseRoute() {
		return "/resumeEmploymentIntention/";
	}

	/**
	* 当前模板名称
	* @return
	*/
	@Override
	public String getModelName(){
		return "求职意向";
	}

	@Override
	public Class exportExcelClass() {
		return ResumeEmploymentIntentionDomainExport.class;
	}

	@Override
	public Set<String> totalMapSet() {
		Set totalMapSet=new HashSet();
		totalMapSet.add("count(resume_employment_intention.rei_id) as countNum");
		return totalMapSet;
	}


}